// File: request.js
const url_all = {
  'DEV': 'http://localhost:3000', // 开发
}

let BASEURL = url_all['DEV']

// 发起请求
const request = (options) => {
  return new Promise((resolve, reject) => {
    uni.request({
      url: BASEURL + options.url,
      method: options.method,
      data: options.data,
      success: (response) => {
        resolve(response.data);
      },
      fail: (fail) => {
        console.error('fail', fail);
        reject(fail);
      }
    });
  });
};

export default request;
